using System;
using System.Windows.Forms;

namespace ICSharpCode.TextEditor.Util
{
    public class MouseWheelHandler
    {
        private int mouseWheelDelta;

        public int GetWheelDeltaScrollDistance(MouseEventArgs e)
        {
            int num;
            checked
            {
                mouseWheelDelta += e.Delta;
                num = Math.Max(SystemInformation.MouseWheelScrollLines, 1);
            }
            int result = checked(mouseWheelDelta * num) / 120;
            mouseWheelDelta %= Math.Max(1, 120 / num);
            return result;
        }
    }
}
